﻿<phone:PhoneApplicationPage 
    x:Class="UltraLight.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:design="clr-namespace:UltraLight" xmlns:MVVM="clr-namespace:UltraLight.MVVM;assembly=UltraLight.MVVM" mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
	<phone:PhoneApplicationPage.ApplicationBar>
		<shell:ApplicationBar>
			<shell:ApplicationBarIconButton IconUri="/icons/appbar.close.rest.png" IsEnabled="True" Text="delete"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
            </shell:ApplicationBar.MenuItems>
		</shell:ApplicationBar>
	</phone:PhoneApplicationPage.ApplicationBar>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">         
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="UltraLight.mvvm" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="Demo App" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>

        <!--ContentPanel - place additional content here-->
        <Border Grid.Row="1" x:Name="ContentBorder" BorderThickness="5" BorderBrush="White">
            <Grid 
                d:DataContext="{d:DesignInstance design:DesignMainViewModel, IsDesignTimeCreatable=True}"
                x:Name="ContentPanel" Margin="12,0,12,0">                
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Text="Enter Some Text:"/>
                <TextBox x:Name="tbText" Grid.Row="1" Text="{Binding Text,Mode=TwoWay}"/>
                <TextBlock Text="{Binding Text}" Grid.Row="2"/>
                <Button Grid.Row="3" Content="Send Event" 
                        MVVM:ButtonCommand.Command="{Binding EventCommand}"                        
                        HorizontalAlignment="Center"/>
                <Button Grid.Row="4" Content="Red Border" 
                        MVVM:ButtonCommand.Command="{Binding StateCommand}"
                        MVVM:ButtonCommand.CommandParameter="RedBorder"
                        HorizontalAlignment="Center"/>
                <Button Grid.Row="5" Content="Yellow Border" 
                        MVVM:ButtonCommand.Command="{Binding StateCommand}"
                        MVVM:ButtonCommand.CommandParameter="YellowBorder"
                        HorizontalAlignment="Center"/>
                <Button Grid.Row="6" Content="Next Page" 
                        MVVM:ButtonCommand.Command="{Binding NavigateCommand}"                        
                        HorizontalAlignment="Center"/>
            </Grid>
        </Border>
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="BorderStates">
                <VisualStateGroup.States>
                    <VisualState x:Name="RedBorder">                        
                    	<Storyboard>
                    		<ColorAnimation Duration="0" To="#FFF90A0A" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="ContentBorder" d:IsOptimized="True"/>
                    	</Storyboard>                        
                    </VisualState>
                    <VisualState x:Name="YellowBorder">                       
                    	<Storyboard>
                    		<ColorAnimation Duration="0" To="#FFE7F314" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" Storyboard.TargetName="ContentBorder" d:IsOptimized="True"/>
                    	</Storyboard>                       
                    </VisualState>
                </VisualStateGroup.States>
                <VisualStateGroup.Transitions>
                    <VisualTransition To="RedBorder" GeneratedDuration="0:0:0.5"/>
                    <VisualTransition To="YellowBorder" GeneratedDuration="0:0:0.5"/>
                </VisualStateGroup.Transitions>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>   

</phone:PhoneApplicationPage>